<div class="ranking">
  <div class="tit">排行榜</div>
  <div class="more link_gray6"><a href="#" class="select J_rankselect" data-type="day">今天</a><span>·</span><a href="#" class="J_rankselect" data-type="week">本周</a><span>·</span><a href="{:U('ranking/index')}">更多</a>
  </div>
  <div class="clear"></div>
  <div id="rankday">
    <ytata:rank listname="rank" type="answer" limit="7" time="day"/>
    <empty name="rank">
      <div class="infoempty">排行空缺中...</div>
      <else/>
      <volist name="rank" id="rank">
        <div class="list">
          <div class="td1">{$key+1}.</div>
          <div class="td2"><img src="{$rank.user.avatar}" /></div>
          <div class="td3 link_gray6"><a href="{$rank.user.user_url}">{$rank.user.nickname}</a></div>
          <div class="td4">+{$rank.num}</div>
          <div class="clear"></div>
        </div>
      </volist>
    </empty>
  </div>
  <div id="rankweek" style="display: none;">
    <ytata:rank listname="rank" type="answer" limit="7" time="week"/>
    <empty name="rank">
      <div class="infoempty">排行空缺中...</div>
      <else/>
      <volist name="rank" id="rank">
        <div class="list">
          <div class="td1">{$key+1}.</div>
          <div class="td2"><img src="{$rank.user.avatar}" /></div>
          <div class="td3 link_gray6"><a href="{$rank.user.user_url}">{$rank.user.nickname}</a></div>
          <div class="td4">+{$rank.num}</div>
          <div class="clear"></div>
        </div>
      </volist>
    </empty>
  </div>

</div>
<script>
    // 排行榜选项卡切换
    $(".J_rankselect").click(function (e) {
        e.preventDefault();
        var type = $(this).data('type');
        $(".J_rankselect").removeClass('select');
        $(this).addClass('select');
        $("#rankweek,#rankday").hide();
        $("#rank"+type).show();
    });
</script>